<template>
  <van-pull-refresh v-model="Dwnloading" @refresh="onRefresh">
    <slot></slot>
  </van-pull-refresh>
</template>

<script lang="ts">
  import { useI18n } from '@/i18nPlugin'
  import { toRefs, defineComponent, reactive, onMounted } from 'vue'
  export default defineComponent({
    nem: 'XXX',
    setup: (props, context) => {
      const i18n = useI18n()
      const data = reactive({
        Dwnloading: false
      })
      const onRefresh = () => {
        data.Dwnloading = true
        setTimeout(() => {
          data.Dwnloading = false
          context.emit('refReshSend')
        }, 1000)
      }
      onMounted(() => {
        // onRefresh()
      })
      return { ...toRefs(data), i18n, onRefresh, onMounted }
    }
  })
</script>

<style scoped lang="scss">
  :deep(.van-pull-refresh),
  .van-pull-refresh {
    height: 100rem;
    background: $theme-bg;
  }
</style>
